package com.twu.biblioteca;

import java.util.ArrayList;

/**
 * Created by administrator on 14-4-20.
 */
public class list_movie {
    ArrayList<movie> movie_list = new ArrayList<movie>();
    public list_movie(){
        for (int i = 0; i < 3; i++){
            movie movie= new movie();
            movie.setMoviename("movie"+i);
            movie.setYear(2014);
            movie.setDirector("zhangyimou");
            movie.setRate("unrated");
            movie.setStatus(true);
            movie_list.add(movie);
        }
    }
    public ArrayList<movie> list_avalliable_movie(ArrayList<movie> movielist){
        ArrayList<movie> avalliable_list = new ArrayList<movie>();
        for(int i =0; i< movielist.size();i++){
            if (movielist.get(i).getstatus())
                avalliable_list.add(movielist.get(i));
        }
        return avalliable_list;
    }
    public void show_list(ArrayList<movie> movielist){
        for (int i = 0; i < movielist.size(); i++)
            System.out.println(movielist.get(i).getMoviename()+" "+movielist.get(i).getYear()+" "
                    +movielist.get(i).getDirector()+" "+movielist.get(i).getRate());
    }
    public ArrayList<movie> get_movie_list(){
        return movie_list;
    }
}
